#include<iostream>
#include<cstring>
using namespace std;
const int maxn = 5010;

int fa[maxn],n,m,t;


int find(int x){
	while(x!=fa[x])	x=fa[x];
	return x;
}

void unionn(int x,int y){
	int fx = find(x);
	int fy = find(y);
	fa[fy]=fx;
}

int main(){
	cin>>n>>m>>t;
	for(int i=1;i<=n;i++)fa[i]=i;
	int a,b;
	for(int i=1;i<=m;i++){
		cin>>a>>b;
		unionn(a,b);
		unionn(b,a);
	}
	
	for(int i=1;i<=t;i++){
		cin>>a>>b;
		if(find(a)==find(b)){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
	return 0;
}